﻿using System.Configuration;
using Insesoft.Entities.Repositories;
using NHibernate.Cfg;
using NHibernate.Dialect;
using NHibernate.Driver;
using Configuration = NHibernate.Cfg.Configuration;

namespace Insesoft.Entities.Repository
{
    public class SqlRepository: BaseRepository
    {
        #region Methods: Non-Public

        protected override Configuration CreateConfiguration()
        {
            var configuration = base.CreateConfiguration();
            configuration.SetProperty(Environment.ReleaseConnections, "on_close")
                .SetProperty(Environment.Dialect, typeof(MsSql2008Dialect).AssemblyQualifiedName)
                .SetProperty(Environment.ConnectionDriver, typeof(SqlClientDriver).AssemblyQualifiedName)
                .SetProperty(Environment.ConnectionString, ConfigurationManager.ConnectionStrings["INSE"].ToString());

            return configuration;
        }

        #endregion
    }
}
